package com.ruoyi.system.controller;

import java.util.List;
import javax.servlet.http.HttpServletResponse;
import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.PutMapping;
import org.springframework.web.bind.annotation.DeleteMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import com.ruoyi.common.annotation.Log;
import com.ruoyi.common.core.controller.BaseController;
import com.ruoyi.common.core.domain.AjaxResult;
import com.ruoyi.common.enums.BusinessType;
import com.ruoyi.system.domain.AiZydT;
import com.ruoyi.system.service.IAiZydTService;
import com.ruoyi.common.utils.poi.ExcelUtil;
import com.ruoyi.common.core.page.TableDataInfo;

/**
 * 资源点价格Controller
 * 
 * @author ruoyi
 * @date 2025-07-08
 */
@RestController
@RequestMapping("/ai/zyd")
public class AiZydTController extends BaseController
{
    @Autowired
    private IAiZydTService aiZydTService;

    /**
     * 查询资源点价格列表
     */
    @PreAuthorize("@ss.hasPermi('ai:zyd:list')")
    @GetMapping("/list")
    public TableDataInfo list(AiZydT aiZydT)
    {
        startPage();
        List<AiZydT> list = aiZydTService.selectAiZydTList(aiZydT);
        return getDataTable(list);
    }

    /**
     * 导出资源点价格列表
     */
    @PreAuthorize("@ss.hasPermi('ai:zyd:export')")
    @Log(title = "资源点价格", businessType = BusinessType.EXPORT)
    @PostMapping("/export")
    public void export(HttpServletResponse response, AiZydT aiZydT)
    {
        List<AiZydT> list = aiZydTService.selectAiZydTList(aiZydT);
        ExcelUtil<AiZydT> util = new ExcelUtil<AiZydT>(AiZydT.class);
        util.exportExcel(response, list, "资源点价格数据");
    }

    /**
     * 获取资源点价格详细信息
     */
    @PreAuthorize("@ss.hasPermi('ai:zyd:query')")
    @GetMapping(value = "/{ id}")
    public AjaxResult getInfo(@PathVariable(" id") Long  id)
    {
        return success(aiZydTService.selectAiZydTBy id( id));
    }

    /**
     * 新增资源点价格
     */
    @PreAuthorize("@ss.hasPermi('ai:zyd:add')")
    @Log(title = "资源点价格", businessType = BusinessType.INSERT)
    @PostMapping
    public AjaxResult add(@RequestBody AiZydT aiZydT)
    {
        return toAjax(aiZydTService.insertAiZydT(aiZydT));
    }

    /**
     * 修改资源点价格
     */
    @PreAuthorize("@ss.hasPermi('ai:zyd:edit')")
    @Log(title = "资源点价格", businessType = BusinessType.UPDATE)
    @PutMapping
    public AjaxResult edit(@RequestBody AiZydT aiZydT)
    {
        return toAjax(aiZydTService.updateAiZydT(aiZydT));
    }

    /**
     * 删除资源点价格
     */
    @PreAuthorize("@ss.hasPermi('ai:zyd:remove')")
    @Log(title = "资源点价格", businessType = BusinessType.DELETE)
	@DeleteMapping("/{ ids}")
    public AjaxResult remove(@PathVariable Long[]  ids)
    {
        return toAjax(aiZydTService.deleteAiZydTBy ids( ids));
    }
}
